package ua.tach.shortl.logic;

import ua.tach.shortl.Renderer;

import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Vector2;

public class CrashPlace{
	private Texture tex;
	private Mesh mesh;
	private float rotate;
	private Vector2 pos;

	public CrashPlace(Vector2 c) {
		tex = Renderer.toLoad[19].tx;
		mesh = Renderer.toLoad[19].m;
		pos = c;
	}

	public boolean tick() {
		rotate += 5;
		return false;
	}

	public void render(GL10 gl) {
		tex.bind();
		gl.glPushMatrix();
		gl.glTranslatef(pos.x, 0, pos.y);
		gl.glRotatef(rotate, 0, rotate, 0);
		mesh.render(GL10.GL_TRIANGLES);
		gl.glPopMatrix();
	}

	public float dist (Vector2 d) {
		return pos.dst(d);
	}
}
